import {
  Component, EventEmitter, Output, Input, OnInit, HostBinding, HostListener, DoCheck, ChangeDetectionStrategy
} from '@angular/core';
import {cardAnim} from "../../anims/card.anim";
@Component({
  selector: 'app-project-item',
  templateUrl: './project-item.component.html',
  styleUrls: ['./project-item.component.scss'],
  animations:[cardAnim],
  changeDetection:ChangeDetectionStrategy.OnPush
})
export class ProjectItemComponent implements OnInit,DoCheck {
  @Input() item;
  @Output() onInvite  = new EventEmitter<void>();
  @Output() onEdit  = new EventEmitter<void>();
  @Output() onDel  = new EventEmitter<void>();
  @Output() onSelected  = new EventEmitter<void>();
  @HostBinding('@card') cardState = 'out';
  constructor() { }
  ngOnInit() {
  }
  onInviteClick(ev:Event) {
    ev.stopPropagation();
    this.onInvite.emit();
  }
  onEditClick(ev:Event) {
    ev.stopPropagation();
    this.onEdit.emit();
  }
  onDelClick(ev:Event) {
    ev.stopPropagation();
    this.onDel.emit();
  }
  onClick(ev:Event) {
    this.onSelected.emit();
  }
  ngDoCheck() {
    console.log('projectlistitem'+'本组件变更检测完毕')
  }
  @HostListener('mouseenter')
  onMouseEnter() {
    this.cardState = 'in';
  }
  @HostListener('mouseleave')
  onMouseLeave() {
    this.cardState = 'out';
  }
}
